#e
#Title[ug|l}Xrw[^-Lunatic-v]
#Text[Čx͂܂܂
G@̓}]
#ScriptVersion[2]
#Player[FREE]
#PlayLevel[Lunatic]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let name = "ug|l}Xrw[^-Lunatic-v";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetMovePosition02(GetCenterX, GetCenterY, 5);
  SetLife(10000);
  SetScore(3000000);
  SetDamageRate(65, 90);

  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(0, 0, 64, 64);

  TMain;
 }

 @MainLoop {
  SetCollisionA(GetX, GetY, 24);
  SetCollisionB(GetX, GetY, 24);

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

 task TMain {
  yield;

  TShot;
  TCome;
 }

 task TShot {
  let math = 0;
  let angle = 0;
  let span = 0;
  yield;

  loop {
   loop(70) { yield; }
   nway(angle, math, span, 1.6, PURPLE02);
   math += 1;
   angle += rand(10, 270);
   span += rand(10, 270);
   if(math == 51) {
    math = 50;
   }
  }
 }

 task TCome {
  let angle = 0;
  let span = 0;
  let speed = 0;
  yield;

  loop {
   loop(80) { yield; }
   nway(angle, 20, span, speed, PURPLE11);
   angle += rand(10, 270);
   span += rand(10, 270);
   speed += rand(0.2, 0.8);
   if(speed > 0.8) {
    speed = 0.2;
   }
  }
 }

 function nway(dir, way, span, speed, color) {
  let mid = dir - (way - rand(1, 3)) / rand(2, 6) * span;
  loop(way) {
   CreateShot01(GetX, GetY, speed, mid, color, 0);
   mid += span;
  }
 }

}